<template>
  <div class="search">
    <f-form ref="form" :action="api.audio" :form-key="this.formItem.audioId" >
      <f-form-item label="音频标题"  name="audioTitle"   :required="true" :value="formItem.audioTitle" />
      <f-form-item label="音频本地地址" tip="仅支持AAC格式" :fileSize="10240" accept=".aac" type="file" name="audioUrl"   :required="true" :value="formItem.audioUrl" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'audioForm',
    props: {},
    data() {
      return {
        api:api,
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          audioId: '',
          audioTitle: '',
          audioUrl: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.audioId) {
          this.formItem = data
          this.isAdd = false
          this.loaded = true
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({}, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
